import 'package:flutter/material.dart';
import 'card_demo.dart';
import 'data_table_demo.dart';
import 'paginated_data_table_demo.dart';
import 'stepper_demo.dart';

class MdcListViewDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MdcListView();
  }
}

class MdcListView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: <Widget>[
        MdcListViewItem(
          title: 'CardDemo',
          page: CardDemo(),
        ),
        MdcListViewItem(
          title: 'DataTableDemo',
          page: DataTableDemo(),
        ),
        MdcListViewItem(
          title: 'PaginatedDataTableDemo',
          page: PaginatedDataTableDemo(),
        ),
        MdcListViewItem(
          title: 'StepperDemo',
          page: StepperDemo(),
        ),
      ],
    );
  }
}

class MdcListViewItem extends StatelessWidget {
  final String title;

  final Widget page;

  MdcListViewItem({this.title, this.page});

  @override
  Widget build(BuildContext context) {
    return ListTile(
      title: Text(title),
      onTap: () {
        Navigator.of(context)
            .push(MaterialPageRoute(builder: (context) => page));
      },
    );
  }
}
